package cn.dansj.service.Impl;

import cn.dansj.entity.InterfaceGroup;
import cn.dansj.repository.InterfaceGroupRepository;
import cn.dansj.service.InterfaceGroupService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class InterfaceGroupServiceImpl implements InterfaceGroupService {
    private final InterfaceGroupRepository interfaceGroupRepository;

    public InterfaceGroupServiceImpl(InterfaceGroupRepository interfaceGroupRepository) {
        this.interfaceGroupRepository = interfaceGroupRepository;
    }

    @Override
    public void save(InterfaceGroup interfaceGroup) {
        interfaceGroupRepository.save(interfaceGroup);
    }

    @Override
    public void save(List<InterfaceGroup> interfaceGroups) {
        interfaceGroupRepository.saveAll(interfaceGroups);
    }

    @Override
    public List<String> getGround() {
        return interfaceGroupRepository.getGround();
    }

    @Override
    @Transactional
    public void deleteByInterfaceSequence(String sequence) {
        interfaceGroupRepository.deleteAllByInterfaceSequence(sequence);
    }
}
